﻿/*
**  BodyDef
*/
if (!$.Engine.Dynamic || typeof $.Engine.Dynamic === "undefined") $.Engine.Dynamic = {};
$.Engine.Dynamic.BodyDef = function () {
  this.shapes = new Array();
  //

  this.userData = null;
  for (var i = 0; i < $.Engine.Settings.maxShapesPerBody; i++) {
    this.shapes[i] = null;
  }
  this.position = new $.Engine.Math.Vector2D(0.0, 0.0);
  this.rotation = 0.0;
  this.linearVelocity = new $.Engine.Math.Vector2D(0.0, 0.0);
  this.angularVelocity = 0.0;
  this.linearDamping = 0.0;
  this.angularDamping = 0.0;
  this.allowSleep = true;
  this.isSleeping = false;
  this.preventRotation = false;
};
Object.extend($.Engine.Dynamic.BodyDef.prototype, {
  userData: null,
  shapes: new Array(),
  position: null,
  rotation: null,
  linearVelocity: null,
  angularVelocity: null,
  linearDamping: null,
  angularDamping: null,
  allowSleep: null,
  isSleeping: null,
  preventRotation: null,

  AddShape: function (shape) {
    for (var i = 0; i < $.Engine.Settings.maxShapesPerBody; ++i) {
      if (this.shapes[i] == null) {
        this.shapes[i] = shape;
        break;
      }
    }
  }
});
